package battleship;

public class ArmoredShip extends Ship
{
	protected int armoure;
	public ArmoredShip(int n) 
	{
		super(n);
		this.armoure = 1;
	}
	
	@Override
	public int determineShipStatus(int id) throws MissException
	{
		int i;
		if((id == ConfigureGame.BATTLESHIP_ID) || (id == ConfigureGame.DESTROYER_ID))
		{
			if (armoure == 1)
			{
				armoure = 0;
				throw new MissException();
			}
			else
			{
				for(i=0;i<this.ship_nr_of_blocks;i++)
					this.components[i].playDead();
				System.out.println("SUNK! "+"Ship: "+ this.getClass().getName());
				return ConfigureGame.SHIP_SUNK_CODE;
			}
		}
		else
			return super.determineShipStatus(id);
	}
}
